package org.itboys.admin.service;

import org.itboys.admin.entity.GlobalConfigRecordDB;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseService;
import org.itboys.mongodb.utils.page.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2016/6/13.
 */
@Service
public class GlobalConfigRecordService extends BaseService<GlobalConfigRecordDB, Long> {

    @Resource(name="sellerDS")
    private MongoDataSource ds;

    @Override
    protected MongoDataSource getMongoDataSource() {
        return ds;
    }

    @Override
    protected Class<GlobalConfigRecordDB> getEntityClass() {
        return GlobalConfigRecordDB.class;
    }

    /**
     * 分页查询
     *
     * @param id
     * @return
     */
    public Page<GlobalConfigRecordDB> pageQueryAll(HttpServletRequest request) {
        Page<GlobalConfigRecordDB> page = pageQuery(request);
        return new Page<GlobalConfigRecordDB>(page.getData(), page.getPageNo(), page.getPageSize(), page.getTotal());
    }
}
